package com.applcn.user.repo.repository;

import com.applcn.user.repo.entity.UserRoleEntity;
import com.applcn.user.repo.mapper.UserRoleMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * com.applcn.user.repo.repository
 * Description:
 *
 * @author: 大妖怪
 * @date: 2020-03-10 02:30
 */
@Repository
public class UserRoleRepository extends ServiceImpl<UserRoleMapper, UserRoleEntity> {

    /**
     * 获取用户角色列表
     *
     *
     * @param userId
     * @return
     */
    public List<UserRoleEntity> getUserRoleListByUserId(Long userId) {
        return baseMapper.selectList(
                new QueryWrapper<UserRoleEntity>()
                .lambda()
                .eq(UserRoleEntity::getUserId, userId)
        );
    }
}
